package com.pengshun.modules.api.news.service.impl;

import com.pengshun.modules.api.mapper.NewsMapper;
import com.pengshun.modules.api.news.service.NewsService;
import com.pengshun.modules.api.news.service.dto.NewsDto;
import com.pengshun.modules.common.BaseResult;
import com.pengshun.modules.common.PagePara;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author luoligang
 * @create 2021/1/20
 */
@Service
@RequiredArgsConstructor
public class NewsServiceImpl implements NewsService {

    private final NewsMapper newsMapper;

    @Override
    public BaseResult getOrderListByStatus(PagePara dto) {
        List<NewsDto>  list=newsMapper.selectNewsList(dto.getPage(),dto.getSize(),dto.getStatus());
        return new BaseResult(0,list);
    }

    @Override
    public BaseResult getNewsDetil(Long newId) {
        NewsDto  list=newsMapper.getNewsDetil(newId);
        return new BaseResult(0,list);
    }

    @Override
    public BaseResult getHomeList() {
        List<NewsDto> list=newsMapper.getHomeList();

        return new BaseResult(0,list);
    }
}
